<?php
$request = system_controller_front::getInstance()->getRequest();
$controller = $request->getControllerName();
$action = $request->getActionName();
?>
<div class="box">
	<?php if($controller == 'category' && ($action = 'index' || $action = 'list') && isset($this->category['cover'])) {?>
	<div class="bd">
		<div class="cover">
			<img src="<?php echo $this->category['_cover']['thumb'];?>" />
		</div>
	</div>
	<div class="clear"></div>
	<?php } ?>
	<?php if($controller == 'special' && $action = 'index' && isset($this->special['_cover'])) {?>
	<div class="bd">
		<div class="cover">
			<a href="<?php echo $this->special['_gurl'];?>">
			<img src="<?php echo $this->special['_cover']['thumb'];?>" alt="<?php echo $this->escape($this->special['title']);?>" />
			</a>
		</div>
	</div>
	<div class="clear"></div>
	<?php } ?>
	<div class="hd"><h3 class="special"><?php echo $this->language('赞助商广告');?></h3></div>
	<div class="bd">
		<?php echo $this->advertise('sidebar242x250')->render($this->client); ?>
	</div>
	<?php if($controller == 'sns') { ?>
	<div class="hd"><h3 class="special"><?php echo $this->language('推荐好图');?></h3></div>
	<div class="bd">
		<ul class="list ilist"><?php 
			foreach((array) $this->cache()->index()->getRecommendSpecials(array('limit' => '20')) AS $row) {
				$title = $this->escape($row['title']);
				$img = $row['_cover'];
				echo '<li><div><a href="' . $row['_url'] . '" title="' . $title . '(' . $row['ptotal'] . ' )" target="_blank"><span><img src="' . $img['thumb'] . '" /></span></a></div></li>';
			}
		?></ul>
		<div class="clear"></div>
	</div>
	<?php } ?>
	<div class="hd"><h3 class="special"><?php echo $this->language('热门好图');?></h3></div>
	<div class="bd">
		<ul class="list"><?php 
			foreach((array) $this->cache()->sidebar()->getSidebarHotSpecials(array('limit' => '20')) AS $row) {
				$title = $this->escape($row['title']);
				echo '<li><a href="' . $row['_url'] . '" title="' . $row['ptotal'] . ' photo(s)" target="_blank">' . $title . '</a></li>';
			}
		?></ul>
	</div>
	<div class="hd"><h3 class="tag"><?php echo $this->language('好图标签');?></h3></div>
	<div class="bd">
		<?php echo $this->render('../_inc/tags.phtml');?>
	</div>
	<?php if($controller == 'index' && $action = 'index') { ?>
	<div class="hd"><h3 class="friendsite"><?php echo $this->language('友情链接');?></h3></div>
	<div class="bd">
		<ul class="list"><?php 
			foreach((array) $this->cache()->sidebar()->getSidebarFriendsite(array('limit' => '12')) AS $row) {
				$title = $this->escape($row['description'] ? $row['description'] : $row['name']);
				echo '<li><a href="' . $row['url'] . '" target="_blank" title="' . $title . '">';
				echo $this->escape($row['name']);
				echo '</a></li>';
			}
		?></ul>
	</div>
	<?php } ?>
	<div class="clear"></div>
</div>	